#!/bin/bash
source src/conf/config.conf
cd $tftp_dir

mkdir -p windows/{winxp,win2k,win2k3}
selection=
until [ "$selection" = "0"]; do

  echo "1 - Install XP"
  echo "2 - Install win2003"
  echo "3 - Install win2000"
 echo "0 - Exit chooser"
     echo ""
     echo -n "Enter Selection:"
     read selection
     echo ""
     case $selection in
         1 ) echo "This install xp"
	cd windows/winxp/
#wget -c  xp.tar.gz

      #  tar -xzvf xp.tar.gz ./winxp/
echo "extracting xp image..."
tar -zxvf xp.tar.gz
unzip winxp.zip

tar -xvf bootfiles.tar -C /var/www/tftp/

rm xp.tar.gz winxp.zip bootfiles.tar

cat >> pxelinux.cfg/windows << EOF

default vesamenu.c32
prompt 0
timeout 0
menu title windows 
menu include pxelinux.cfg/graphics.conf
LABEL Windows XP Netboot
MENU LABEL Windows XP Netboot
kernel memdisk
append initrd=windows/winxp/winxp.IMA    
EOF


cat >> /etc/samba/smb.conf << EOF

 [winxp]
 path = /var/www/tftp/windows/winxp/ 
 public = yes
 writable = no
 comment = windows share
 printable = no
 guest ok = yes

EOF	
;;
        
 2 ) echo "This install 2003"
			cd windows/win2k3/
#wget -c  win2003.tgz

      #  tar -xzvf xp.tar.gz ./winxp/
echo "extracting 2003 image..."
tar -zxvf win2003.tgz 
tar -xvf win2k3.tar


tar -xvf bootfiles.tar -C /var/www/tftp/

rm win2003.tgz win2k3.tar bootfiles.tar


cat >> pxelinux.cfg/windows << EOF

default vesamenu.c32
prompt 0
timeout 0
menu title windows 
menu include pxelinux.cfg/graphics.conf
LABEL Windows 2003 Netboot
MENU LABEL Windows 2003 Netboot
kernel memdisk
append initrd=windows/win2k3/win2k3.IMA    
EOF

cat >> /etc/samba/smb.conf << EOF

 [win2k3]
 path = /var/www/tftp/windows/win2k3/ 
 public = yes
 writable = no
 comment = windows share
 printable = no
 guest ok = yes

EOF;;

 3 ) echo "This install 2000"
			cd windows/win2k/
#wget -c  win2000.tgz

      #  tar -xzvf xp.tar.gz ./winxp/
echo "extracting 2000 image..."
tar -zxvf win2000.tgz 
tar -xvf win2k.tar


tar -xvf bootfiles.tar -C /var/www/tftp/

rm win2000.tgz win2k.tar bootfiles.tar

cat >> pxelinux.cfg/windows << EOF

default vesamenu.c32
prompt 0
timeout 0
menu title windows 
menu include pxelinux.cfg/graphics.conf
LABEL Windows 2000 Netboot
MENU LABEL Windows 2000 Netboot
kernel memdisk
append initrd=windows/win2k/win2k.IMA    
EOF


cat >> /etc/samba/smb.conf << EOF

 [win2k]
 path = /var/www/tftp/windows/win2k/ 
 public = yes
 writable = no
 comment = windows share
 printable = no
 guest ok = yes

EOF

;;
0 ) exit;;
         * ) echo "Please enter 1, 2, 3 or 0"
     esac
done

